Data Analysis For Motor Trend Car Road Tests

Author

Devneet Mohanty

Published

May 20, 2025

Background

The mtcars data originated in the 1974 Motor Trend magazine and records fuel economy alongside various mechanical specs for 32 different car models. In this brief analysis, I will:

  1. Calculate basic summary measures for MPG and HP.
  2. Create an interactive scatter showing how miles per gallon changes with engine power.
  3. Offer a few observations on what the plot reveals.

Summary Statistics

First, we will compute means and standard deviations for our two key metrics using dplyr package.

  Mean_MPG   SD_MPG  Mean_HP    SD_HP
1 20.09062 6.026948 146.6875 68.56287

Scatterplot Between Miles Per Gallon & Horsepower

Below is an interactive chart built using ggplot2 and plotly packages. We’ve added a dashed linear trend and shaded 95% confidence band to highlight the overall relationship between Miles Per Gallon (mpg) and Horsepower (hp).

Interpretation Of Relationship

  • There’s a clear inverse trend: as horsepower goes up, miles per gallon tends to go down.

  • The shaded ribbon around the dashed line shows our 95% confidence interval for the fitted regression.

  • Understanding this trade-off can guide decisions about performance versus economy when selecting a vehicle.